﻿@using MvcModels.Models
@model IList<AddressSummary>
@{
    ViewBag.Title = "Address";
}
<h2>Addresses</h2>
@if (Model.Count() == 0)
{
    using (Html.BeginForm())
    {
        for (int i = 0; i < 3; i++)
        {
    <fieldset>
        <legend>Address @(i + 1)</legend>
        <div>
            <label>City:</label>@Html.Editor("[" + i + "].City")</div>
        <div>
            <label>Country:</label>@Html.Editor("[" + i + "].Country")</div>
    </fieldset>
        }
    <button type="submit">Submit</button>
    }
}
else
{
    foreach (AddressSummary str in Model)
    {
    <p>@str.City, @str.Country</p>
    }
    @Html.ActionLink("Back", "Address");
}